//
//  Mine.swift
//  LoveFreshBeen
//
//  Created by Gao on 17/2/11.
//  Copyright © 2017年 Odm. All rights reserved.
//

import UIKit

class MineData: NSObject {
    var has_new: Int = -1
    var has_new_user: Int = -1
    var availble_coupon_num = 0
}

class Mine: NSObject {
    
    var code: Int = -1
    var msg: String?
    var reqid: String?
    var data: MineData?
    
    // 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
    class func modelContainerPropertyGenericClass() -> [AnyHashable: Any] {
        return ["data": MineData.self]
    }
    
    class func loadMineData(_ completion:(_ data: Mine?, _ error: NSError?) -> Void) {
        guard let path = Bundle.main.path(forResource: "Mine", ofType: nil) else{
            return
        }
        
        let url = URL(fileURLWithPath: path)
        
        guard let jsonString = try? String(contentsOf: url) else{
            return
        }
        
        let mine = Mine.yy_model(withJSON: jsonString)
        
        if mine != nil {
            completion(mine, nil)
        }

    }
    
}


